* Date: August 13, 2019
* Purpose: Figures & tables for FHP application

cls
clear all 
set more off
capture log close

* cd "D:\Dropbox\data"

********************************************************************************
* Figure 3A
********************************************************************************

use FHP_Fig3.dta, clear

* Figure 3 (A)

generate lnG0 = log(G0)       
generate lnG1 = log(G1)
twoway (line lnG0 Year, lcolor(black) lpattern(dash)) (line lnG1 Year, lcolor(blue)), ylabel(3.0(0.5)4.0) xlabel(2002(2)2012) xline(2005, lpattern(dot)) xtitle("Year",size(medlarge) height(6)) ytitle("Log Hosp CSPC Rate", size(medlarge) height(6)) graphregion(color(white)) bgcolor(white) ylab(,nogrid)
		   

********************************************************************************
* Tables
********************************************************************************

* Table 3: FHP Effect in <=5 years-old

use FHP_Table3_NB.dta, clear

xtset Code Year 

* Models for CSPC Hospitalizations

* Negative Binomial Model: Modeling rate of hospitalization

xtnbreg CSPC FHP time interaction Lifeexp Illiteracy Poverty Income MHDI Beds,exposure(Pop5y) fe
xtnbreg CSPC FHP time interaction Lifeexp Illiteracy Poverty Income MHDI Beds,exposure(Pop5y) fe irr


use FHP_Table3_Binomial.dta, clear

* Binomial Model : Modeling proportion of hospitalization

logit CSPC_Binary FHP time interaction Lifeexp Illiteracy Poverty Income MHDI Beds [fw=w]
logit CSPC_Binary FHP time interaction Lifeexp Illiteracy Poverty Income MHDI Beds [fw=w], or

